{- QoSRegistry.inc.orc -- Orc program QoSManager.inc
 - 
 - $Id$
 - 
 - Created by akattepu on 02-Aug-2012 10:59:39
 -}

--include "QoSWeaver.inc"

val QoSRegistry = 
 [
  {. name = "f", QoSDom = ResponseTime, QoSUnit = Millisecond, Handle = LatencyIncrement .},
  {. name = "f", QoSDom = Cost, QoSUnit = CurrencyDollars, Handle = CostValue .},
  
  {. name = "g", QoSDom = ResponseTime, QoSUnit = Second, Handle = LatencyIncrement .}, 
  {. name = "g", QoSDom = Cost, QoSUnit = CurrencyDollars, Handle = CostValue .},
    
  {. name = "h", QoSDom = ResponseTime, QoSUnit = Second, Handle = LatencyIncrement .},
  {. name = "h", QoSDom = InterQueryTime, QoSUnit = Second, Handle = []  .},
  {. name = "h", QoSDom = Cost, QoSUnit = CurrencyDollars, Handle = CostValue .},
  {. name = "h", QoSDom = SecurityLevel, QoSUnit = Level, Handle = SecurityValue .},
  
  {. name = "TAgent", QoSDom = ResponseTime, QoSUnit = Millisecond, Handle = LatencyIncrement .},
  {. name =  "TAgent", QoSDom = CPUutilization, QoSUnit = Percentage, Handle = CPUutilizationValue .},
  {. name =  "TAgent", QoSDom = InterQueryTime, QoSUnit = Second, Handle = []  .},
  {. name = "TAgent", QoSDom = Cost, QoSUnit = CurrencyEuros, Handle = CostValue .},
  {. name = "TAgent", QoSDom = SecurityLevel, QoSUnit = Level, Handle = SecurityValue .},
   {. name =  "TAgent", QoSDom = Reliability, QoSUnit = Level, Handle = ReliabilityValue .},
  
  {. name = "Airline", QoSDom = Cost, QoSUnit = Items, Handle = CostValue .},
  
  {. name = "Hotel", QoSDom = Cost, QoSUnit = Items, Handle = CostValue  .}
 ]

def QoSMatch(siteID) = each(QoSRegistry) >M> Ift(M.name = siteID) >> (M.QoSDom,M.QoSUnit,M.Handle)

def QoSValidate(callersiteID,caleesiteID) =  (collect(defer(QoSMatch,callersiteID)),collect(defer(QoSMatch,caleesiteID)))  >(A,B)>
 ( Ift(A.QoSDom = B.QoSDom) >> signal |   Iff(A.QoSDom = B.QoSDom) >> Println("Registry Entries Missing") >> stop)